/*
 * @Author: Turump 
 * @Date: 2021-04-26 09:26:27 
 * @Last Modified by: Turump
 * @Last Modified time: 2021-05-13 18:50:49
 */

import { TweenType } from "../../misc/TweenType";
import ActionBaseTask from "./ActionBaseTask";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("动作任务/RotateBy")
export default class RotateByTask extends ActionBaseTask {

    @property({ displayName: "循环次数", tooltip: "无限循环就把数字设大一点" })
    repeatTime = 1;

    @property({ displayName: "角度", tooltip: "正值逆时针" })
    angle = 0;

    getAction() {
        return cc.tween(this.node)
            .repeat(this.repeatTime,
                cc.tween(this.node)
                    .parallel(
                        this.getPlayAudioTween(),
                        cc.tween(this.node)
                            .by(this.actionDuration, { angle: this.angle }
                                , { easing: Object.keys(TweenType)[this.easeType] }))
            );
    }
}
